package com.hanbang.baseproject.view.home.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.hanbang.baseproject.R;
import com.hanbang.baseproject.code.base.baseadapter.ViewHolder;
import com.hanbang.baseproject.code.base.baseadapter.recyclerview.CommonAdapter;
import com.hanbang.baseproject.code.base.presenter.BasePresenter;
import com.hanbang.baseproject.code.base.view.activity.BaseMainActivity;
import com.hanbang.baseproject.mode.javabean.base.BannerAdData;
import com.hanbang.baseproject.mode.javabean.home.TestData;
import com.hanbang.baseproject.utils.ui.divider.HorizontalDividerItemDecoration;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by yang on 2017/5/3 7:17
 */
public class LinkActivity extends BaseMainActivity {
    @BindView(R.id.switchRoot)
    RecyclerView switchRoot;
    private ArrayList<TestData> mDatas = new ArrayList<>();

    public static void startUI(Activity activity) {
        Intent intent = new Intent(activity, LinkActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public BasePresenter initPressenter() {
        return null;
    }

    @Override
    public int getContentView() {
        return R.layout.activity_home;
    }


    List<BannerAdData> bannerAdDatas = new ArrayList<>();

    @Override
    public void initView() {
        super.initView();
        toolbar.setTitle("微信");


//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493764210983&di=66d49c6debccf9db31d59851827aa106&imgtype=0&src=http%3A%2F%2Fimg.tupianzj.com%2Fuploads%2Fallimg%2F151115%2F9-151115124406.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1493763459742&di=62df4140c4ee151904cd8fe29716f17c&imgtype=0&src=http%3A%2F%2Fimg.sc115.com%2Fhb%2Fgx%2F10%2F88160652322670.jpg"));
//        mDatas.add(new TestData("名字", "今天吃什么", "2017-5-3", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1494359048&di=ffdb8d1cbb2c59d8117b07cc16ea8646&imgtype=jpg&er=1&src=http%3A%2F%2Fimg1.3lian.com%2F2015%2Fa1%2F86%2Fd%2F23.jpg"));

        switchRoot.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this).colorResId(R.color.gray).sizeResId(R.dimen.dp_1).build());
        switchRoot.setLayoutManager(new LinearLayoutManager(this));

        switchRoot.setAdapter(new CommonAdapter<TestData>(this, R.layout.item_evaluate_3, mDatas) {
            @Override
            public void convert(ViewHolder holder, TestData s) {
//                holder.setImageBitmap(R.id.picture, s.img);
                holder.setText(R.id.name, s.name);
            }
        });
    }

    @Override
    public void parseIntent(Intent intent) {

    }

    @Override
    public int currentItem() {
        return 1;
    }

}
